package com.zhuoshi.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.zhuoshi.entity.BargainCustom;
import com.zhuoshi.service.BargainService;

@Controller
@RequestMapping("bargain")
public class BargainController {
	@Autowired
	private BargainService bargainService;
	
//	查询所有合同
	@RequestMapping("selectBargainList")
	public ModelAndView selectBargainList() throws Exception{
		List<BargainCustom> bargainList=bargainService.selectBargainList();
		ModelAndView modelAndView=new ModelAndView();
		modelAndView.addObject("bargainList", bargainList);
		modelAndView.setViewName("/Admin/second/hetongList.jsp");
		return modelAndView;
	}
	
//	删除合同（单个与批量都可以）
	@RequestMapping("deleteBargainByIds")
	public ModelAndView deleteBargainByIds(Integer[] ids) throws Exception{
		Integer rows=bargainService.deleteBargainByIds(ids);
		ModelAndView modelAndView=new ModelAndView();
		modelAndView.setViewName("redirect:selectBargainList.action");
		return modelAndView;
		
	}
}
